<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/taglib.jsp"%>
<jsp:include page="/WEB-INF/common/head.jsp" flush="true" />
<table id="dg"></table>
    <div id="tb" style="padding:2px 5px;">
       
        <div style="text-align: left; margin:6px;">
            	<input name="siteId" id = "siteId" type="hidden" value="${siteId}"/>
            <a href="#" class="easyui-linkbutton delBtn" iconCls="glyphicon-pencil"  id="btn-edit" plain="true" onclick="giveOther()">分配用户</a>
        </div>
    </div>
<script type="text/javascript">
var datagrid = $("#dg");
var siteId = $("#siteId").val();
var dgOptions = {
        rownumbers:true,
    	fit:true,
    	border:false,
        rownumbers:true,
    	url:'${context_path}/sys/obj/getNoGiveListData?siteId='+siteId,
    	method:'post',
    	toolbar:'#tb',
    	pageSize: 20,
    	pagination:true,
    	multiSort:true,
        queryParams: getInitParam(),
        
        columns: [[
		          {field:'id', checkbox:true}
	           	 ,{field:'name', title: '名称', width:120, sortable: true}
	           	 ,{field:'link', title: '链接', width:120, sortable: true}
	           	 ,{field:'type', title: '类型', width:250, sortable: true}
	           	 ,{field:'subject', title: '主题', width:100, sortable: true}
	           ]]
	};
$(function() {
	//handleAuthDataRule();
	datagrid.datagrid(dgOptions);
});

function zcurdSearch() {
	var param = zcurdGetParam();
	datagrid.datagrid("load", {
		queryParams: param
	})
}

function zcurdGetParam() {
	var param = {};
	$("#tb :input[name]").each(function(i, item) {
		if($(item).val()) {
			param[$(item).attr("name")] = $(item).val();	
		}
	});
	return param;
}

function getInitParam() {
	var param = {};
	$("#tb :input[name]").each(function(i, item) {
		if($(item).val()) {
			param["queryParams[" + $(item).attr("name") + "]"] = $(item).val();	
		}
	});
	return param;
}

var initPara = zcurdGetParam();


function giveOther() {
	var ids = "";
	$.each(datagrid.datagrid("getSelections"), function(i, item) {
		ids = ids+item.id+",";
	});
	if(ids.length < 1) {
		showWarnMsg("请选择需要分配的数据！");
		return;
	}
	top.window.subPage.loadCurrDatagrid = function() {
		showMsg("增加成功！");
		datagrid.datagrid("load");
	}
	top.openWindow("对象管理-分配", '${context_path}/sys/obj/objAddUserView?ids='+ids, {size: '600x400'});
}



//按钮事件

/**
 * 打开子页
 */
var _openSubPageFlag = false;
function _openSubPage(pageUrl) {
	if(!_openSubPageFlag) {
		$("#subLayout").layout("expand", "east");
		setTimeout(function() {
			$("#subIframe").attr("src", pageUrl);
		}, 600);
		_openSubPageFlag = true;
	}else {
		$("#subIframe").attr("src", pageUrl);
	}
}

function forword(url){
	window.location.href=url;
}

//扩展js
</script>
  <jsp:include page="/WEB-INF/common/dialogWindow.jsp" flush="true" />
   <jsp:include page="/WEB-INF/common/foot.jsp" flush="true" />